package gamegame;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;

import javax.imageio.*;

import java.io.*;

import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.SwingUtilities;

public class ComputerScreen extends JFrame {
	final ImageIcon img = new ImageIcon("UFCJohnson.png");
	final JLabel spaceship = new JLabel(img);
	boolean blueprint, printed, cleared;
	JMenuBar marsbar;
	JMenu entree;
	JMenuItem item;
	JCheckBoxMenuItem settings;
	public ComputerScreen() {
		super("Wang Explorer 1.0");
		spaceship.setVisible(false);
		add(spaceship);
		blueprint = false;
		printed = false;
		cleared = false;
		marsbar = new JMenuBar();
		entree = new JMenu("File");
		marsbar.add(entree);
		item = new JMenuItem("New");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("Starting new game.");
				System.exit(0);
			}
		});
		entree.add(item);
		item = new JMenuItem("Open Recent...");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(!cleared) {
					blueprint = true;
					spaceship.setVisible(true);
					setSize(1416,829);
				}
			}
		});
		entree.add(item);
		entree.addSeparator();
		item = new JMenuItem("Save");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(blueprint && !spaceship.isVisible()) {
					if(printed) {
						System.out.println("Well, there goes the blueprint. Good thing you printed one out already.");
						cleared = true;
					} else {
						System.out.println("Congratulations. You overwrote the blueprint. GAME OVER");
						System.exit(0);
					}
				}
			}
		});
		entree.add(item);
		item = new JMenuItem("Print");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(spaceship.isVisible()) {
					printed = true;
					System.out.println("Blueprint successfully printed.");
				}
				else
					System.out.println("Paper successfully wasted.");
			}
		});
		entree.add(item);
		entree.addSeparator();
		item = new JMenuItem("Exit");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				derp();
			}
		});
		entree.add(item);
		entree = new JMenu("Edit");
		marsbar.add(entree);
		item = new JMenuItem("Change Font to Comic Sans");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("You are a horrible horrible monster and don't deserve to win the game. GAME OVER");
				System.exit(0);
			}
		});
		entree.add(item);
		item = new JMenuItem("Clear");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(blueprint)
					spaceship.setVisible(false);
			}
		});
		entree.add(item);
		entree = new JMenu("Help");
		marsbar.add(entree);
		item = new JMenuItem("Help");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("Instructions: Use Open Recent to load the blueprints. Then Clear and Save.");
			}
		});
		entree.add(item);
		item = new JMenuItem("About");
		item.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.out.println("Game Developers: ");
				System.out.println("Lucas Schairer: Generic looking white male with a heart of gold and a humor of godawful.");
				System.out.println("Raymond Sun: Has more height than common sense.");
				System.out.println("Support Beomat Industries by offering your firstborn child to a sacrificial altar near you!");
			}
		});
		entree.add(item);
		setJMenuBar(marsbar);
	}
	public void derp() {
		this.dispose();
	}
}
